package com.chilly.other;

/**
 * Created by Chilly Cui on 2020/12/10.
 */
public class Test {
    public static void main(String[] args) {
        foo(0);
        System.out.println(output);//134
        foo(1);
        System.out.println(output);//13423
//        System.out.println(0+"ab");

//        System.out.println(gi());
    }

    public static int gi() {
        int b = 10;
        try {
            System.out.println(b / 0);
            b = 99;
        } catch (ArithmeticException e) {
            b = 66;
            return b;
        } finally {
            b = 20;
            return b;
        }
        //return b;
    }

    public static String output = "";

    public static void foo(int i) {
        try {
            if (i == 1) {
                throw new Exception();
            }
            output += "1";
        } catch (Exception e) {
            output += "2";
            return;
        } finally {
            output += "3";
        }
        output += "4";

    }

    private static void modify(String s) {
        s += "world";
        System.out.println(s);
    }
}
